package com.xinghou.platform.server.api.service.impl;

import com.xinghou.platform.server.api.service.UpphotoService;
import com.xinghou.platform.service.main.PhotoDataProcessService;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 照片信息服务
 * @author xuzhen
 *
 */
@Service("upphotoService")
public class UpphotoServiceImpl extends BaseDAOProtery<PhotoDataProcessService> implements UpphotoService {
	//private String daoUrl = httpServicesDaourl + "dao/main/photoDataProcess";
	@Resource
	private PhotoDataProcessService photoDataProcessService;
	/**
	 *
	 *
	 * 更新用户头像信息
	 * @return
	 * @throws DataAccessException
	 */
	public int updateUserphotoInfoOther(String userid,Map<String,String> data) {
		int simphotoid = photoDataProcessService.updatePhotoHeadData(userid, data);
		
		return simphotoid;
	}
	@Override
	public int updatePhotoShareData(Map<String, String> data) {
		// TODO Auto-generated method stub
		return photoDataProcessService.updatePhotoShareDatas(data);
	}
	@Override
	public int updatePhotoMsgData(Map<String, String> data) {
		// TODO Auto-generated method stub
		return photoDataProcessService.updatePhotoMsgData(data);
	}
	@Override
	public int addVoiceMsgData(Map<String, String> data) {
		//daoUrl = httpServicesDaourl + "dao/main/photoDataProcess";
		return photoDataProcessService.addVoiceMsgData(data);
	}
	@Override
	public int addShopPhoto(Map<String, String> data) {
		// TODO Auto-generated method stub
		return photoDataProcessService.addShopPhotoData(data);
	}

	@Override
	public int addShopPhotos(Map<String, String> data) {
		String[] urls=data.get("shopurl").split(",");
		for(int i=0;i<urls.length;i++)
		{
			data.put("shopurl",urls[i]);
			if(i==0)
				data.put("imagetypeid","999");
			else
			data.put("imagetypeid","2");

			addShopPhoto(data);
		}
		return 0;
	}
}
